package lagou.homework.lagouhomework.Unit4.code.q1;

import java.util.List;

public class SelectStu {
    public static Student selectStu(int id, List<Student> listStu) {
        // 遍历List，返回目标
        for (Student stu : listStu) {
            if (id == stu.getId()) {
                return stu;
            }
        }
        return null;        // 如果不存在，则返回null

    }

}
